#ifndef _xNodeType_composite_H_
#define	_xNodeType_composite_H_

#include "xMappingNodeTypeLibrary.h"
#include "xNodeType.h"

class xNodeType_composite : public xNodeType {
private:
	std::vector< xMappingNode * > outNodes_;

protected: 
	xMappingNodeTypeDescriptor* _vd ;
	xMappingTree* _body ;
	static string valid_rhs_pair[][2];
public:

	xNodeType_composite(string vmname) {  _vd = xMappingNodeTypeLibrary::getInstance()->get_xmnt_descriptor(vmname); 
										  _name = vmname ;
                                   	}
	xNodeType_composite(int index) // use index in xMappingNodeTypeLibrary to new a composite node type
	{_vd = xMappingNodeTypeLibrary::getInstance()->get_xmnt_descriptor(index); 	}
	virtual void		setupPorts() ;
	virtual string		getType() { return "composite" ; }
	virtual void		createMappedObject() ;
	virtual xParameter  toXParameter(string toType, xOutMappingPort *linkedop); 
	virtual bool		update() ;
	virtual string toMDString(MDSType) ;
	int     parseMDString(vector<string>& tokens, int start_index);
	virtual bool verify_rhs_link(xOutMappingPort *left, xInMappingPort *right, xNodeType* rightnode);
	virtual bool verify_lhs_link(xOutMappingPort *left, xNodeType* leftnode, xInMappingPort *right);

	xMappingTree * getxMappingTree() { return _body; }
};

#endif 